﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using The_LarX;
using Microsoft.Xna.Framework;

namespace LarX_Editor
{
    public partial class Array : Form
    {
        private Actor SelectedActor;

        public int Count1D;
        public Vector3 Incremental1D;
        public int Count2D;
        public Vector3 Incremental2D;
        public int Count3D;
        public Vector3 Incremental3D;

        public ArrayShower Shower;

        public Array(Actor selectedActor, Camera3D Camera)
        {
            InitializeComponent();

            this.SelectedActor = selectedActor;

            Shower = new ArrayShower(Engine.GameScreens[0]);
            Shower.Camera = Camera;
        }

        private void button_OK_Click(object sender, EventArgs e)
        {
            Vector3 incre1 = new Vector3((float)move_X.Value, (float)move_Y.Value, (float)move_Z.Value);
            Vector3 incre2 = new Vector3((float)d2_X.Value, (float)d2_Y.Value, (float)d2_Z.Value);
            Vector3 incre3 = new Vector3((float)d3_X.Value, (float)d3_Y.Value, (float)d3_Z.Value);
            int Count1 = (int)d1_Count.Value;
            int Count2 = (int)d2_Count.Value;
            int Count3 = (int)d3_Count.Value;
            ArrayTool.ActorArray(SelectedActor, Count1, incre1,
                Count2, incre2, Count3, incre3);
            Shower.DisableComponent();
            this.Close();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (this.checkBox_Preview.Checked)
            {
                Vector3 incre1 = new Vector3((float)move_X.Value, (float)move_Y.Value, (float)move_Z.Value);
                Vector3 incre2 = new Vector3((float)d2_X.Value, (float)d2_Y.Value, (float)d2_Z.Value);
                Vector3 incre3 = new Vector3((float)d3_X.Value, (float)d3_Y.Value, (float)d3_Z.Value);
                int Count1 = (int)d1_Count.Value;
                int Count2 = (int)d2_Count.Value;
                int Count3 = (int)d3_Count.Value;
                Shower.ListToDraw = ArrayTool.MakeArray(SelectedActor, Count1, incre1,
                    Count2, incre2, Count3, incre3);
            }
            else
            {
                Shower.ListToDraw = null;
            }
        }
    }
}
